package ast.decl;

import java.util.Vector;

import ast.Node;
import ast.type.Type;

public class ParDecl extends Declaration {
	private Integer id;
	private Type type;

	public ParDecl() {
	}

	public ParDecl(Integer id) {
		this.id = id;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public static void type(Vector<ParDecl> list, Type type) {
		for (int i = 0; i < list.size(); i++) {
			list.elementAt(i).setType(type);
		}
	}

	@Override
	public void typeCheck() {
		Node.st.getInfo(id).setType(type);
	}

	@Override
	public String toString() {
		return "<ParDecl id=\"" + id + "\" type=\"" + type + "\"></ParDecl>";
	}

	public Integer getId() {
		return id;
	}

	@Override
	public void genCode() {
		// Node.icg.gen(Quadruple.param(new EQIdent(id.toString())));
	}

}
